<template>
    <div>
        <div class="header flex" :style="'backgroundColor:'+backgroundColor">
      <div class="h-left" @click="toLastPage" v-if="isReturn">
        <van-icon name="arrow-left" :class="returnWhite?'white':''" />
      </div>
      <div class="h-center f-1">
          <slot name="title"></slot>
      </div>
      <div class="h-right" >
          <slot name='right'></slot>
      </div>
    </div>
    </div>
</template>
<script>
export default {
    props:{
        isReturn:{
            type:Boolean,
            default:true
        },
        backgroundColor:{
          type:String,
          default:'#ededed'
        },
        returnWhite:{
          type:Boolean,
          default:false
        }
    },
    methods:{
        toLastPage(){
            this.$emit('toLastPage')
        }
    }
}
</script>
<style scoped>
.header {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  padding: 0 0.3rem;
  height: 1.5rem;
  z-index: 999;
}
.h-left {
  font-size: 0.6rem;
  line-height: 1.5rem;
}
.van-icon{
  font-size: .8rem;
  position: relative;
  top: .2rem;
}
.white{
  color: #ffffff;
}
.h-center {
  font-size: 0.6rem;
  margin-left: 0.3rem;
  line-height: 1.5rem;
  font-weight: 700;
}
.h-right {
  position: relative;
  bottom: 0.2rem;
  min-width: 1rem;
  text-align: right;
}
</style>